/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * com_distri_articulos_movi_inve.java
 *
 * Created on 26/11/2011, 01:37:42 PM
 */

package sie_invdis;


import java.sql.*;
import javax.swing.*;

import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTable.*;
import java.awt.*;
import java.text.*;
import java.util.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import java.text.ParseException;

/**
 *
 * @author Michelle
 */
public class com_distri_articulos_movi_inve extends javax.swing.JFrame {


    private javax.swing.table.DefaultTableModel jtable_modelo_kardex;
    private javax.swing.table.DefaultTableModel jtable_modelo_doctomovidet;
    private javax.swing.table.DefaultTableModel jtable_modelo_doctomovinve;
    private javax.swing.table.DefaultTableModel jtable_modelo_doctodetimprimir;

    private ResultSet rs = null;
    private bd_conexion x = new bd_conexion() ;
    private int buscamp=2,controlcomboinsu=0,opbuscamp=1,control_enter=0,yacarguecatdocto=0,indexactual=0;
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    /** Creates new form com_distri_articulos_movi_inve */
    public com_distri_articulos_movi_inve() {
        this.iniciar_modelo_kardex();
        this.iniciar_modelo_doctodetalle();
        this.iniciar_modelo_movinveinsumos();
        this.iniciar_modelo_detalleaimprimir();
        initComponents();
        this.buttonGroup1.setSelected(jrb_bclave.getModel(), true);
        this.buttonGroup2.setSelected(jbtn_codigo.getModel(), true);
        this.jtf_busqueda.requestFocus();
        this.loadcomalmacenes();
        this.loadcomidtipomovi();
        java.util.Date fechahoya=new Date();
        this.jdc_fechadocto.setDate(fechahoya);
    }

    private void iniciar_modelo_kardex()
 {
        jtable_modelo_kardex=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_kardex.addColumn("<html><BODY><b>Almacen</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>id movi</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Fecha</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Tipo Mov</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Ref.</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>clie/prov</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Articulo</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Descripcion</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Item</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>U.Sal.</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Costo</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Precio</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Cantidad</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Historial</b></BODY></html>");
        jtable_modelo_kardex.addColumn("<html><BODY><b>Observ.</b></BODY></html>");
}
private void iniciar_modelo_doctodetalle()
    {
        jtable_modelo_doctomovidet=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_doctomovidet.addColumn("<html><b>Clave</b></html>");
        jtable_modelo_doctomovidet.addColumn("<html><b>Descripcion</b></html>");
        jtable_modelo_doctomovidet.addColumn("<html><b>Unidad</b></html>");
        jtable_modelo_doctomovidet.addColumn("<html><b>Cantidad</b></html>");
        jtable_modelo_doctomovidet.addColumn("<html><b>Precio</b></html>");
        jtable_modelo_doctomovidet.addColumn("<html><b>Costo</b></html>");
        jtable_modelo_doctomovidet.addColumn("<html><b>Observacion</b></html>");
        jtable_modelo_doctomovidet.addColumn("<html><b>Item</b></html>");
        jtable_modelo_doctomovidet.addColumn("<html><b>Precio</b></html>");
    }
private void iniciar_modelo_movinveinsumos()
        {
            jtable_modelo_doctomovinve=new javax.swing.table.DefaultTableModel();//Creo el modelo
            jtable_modelo_doctomovinve.addColumn("<html><b>Moviemiento</b></html>");
            jtable_modelo_doctomovinve.addColumn("<html><b>Id Alm.</b></html>");
            jtable_modelo_doctomovinve.addColumn("<html><b>Status</b></html>");
            jtable_modelo_doctomovinve.addColumn("<html><b>Docto Ref</b></html>");
            jtable_modelo_doctomovinve.addColumn("<html><b>E. Elaboro</b></html>");
            jtable_modelo_doctomovinve.addColumn("<html><b>Fecha</b></html>");
            jtable_modelo_doctomovinve.addColumn("<html><b>Dias Trans.</b></html>");
            jtable_modelo_doctomovinve.addColumn("<html><b>Piezas</b></html>");
            jtable_modelo_doctomovinve.addColumn("<html><b>Costo</b></html>");
            jtable_modelo_doctomovinve.addColumn("<html><b>Precio</b></html>");
            jtable_modelo_doctomovinve.addColumn("<html><b>Observaciones</b></html>");
        }
private void iniciar_modelo_detalleaimprimir()
    {
        jtable_modelo_doctodetimprimir=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_doctodetimprimir.addColumn("<html><b>Folio</b></html>");
        jtable_modelo_doctodetimprimir.addColumn("<html><b>Clave</b></html>");
        jtable_modelo_doctodetimprimir.addColumn("<html><b>Descripcion</b></html>");
        jtable_modelo_doctodetimprimir.addColumn("<html><b>Item</b></html>");
        jtable_modelo_doctodetimprimir.addColumn("<html><b>Unidad</b></html>");
        jtable_modelo_doctodetimprimir.addColumn("<html><b>Cantidad</b></html>");
        jtable_modelo_doctodetimprimir.addColumn("<html><b>Costo</b></html>");
        jtable_modelo_doctodetimprimir.addColumn("<html><b>Precio</b></html>");
        jtable_modelo_doctodetimprimir.addColumn("<html><b>Observacion</b></html>");
    }
private void loadcomalmacenes()
    {
          this.jcmbx_almacenes.addItem("0:Elegir Almacen");
        try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_almacenes() as (id smallint,cla character varying(30));",variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcmbx_almacenes.addItem(rs.getString("id")+":"+rs.getString("cla"));
                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }
private void loadcomidtipomovi()
    {
          this.jcmbx_idmovimientoalma.addItem("0:Elegir Movimiento");
          try
            {
                rs = x.sieuno_executediversosv2("select * from x1distribucion_artic_termi_mov_tipos() as (id smallint,descrip text);",variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcmbx_idmovimientoalma.addItem(rs.getString("id")+":"+rs.getString("descrip"));
                    }
             }
            catch(Exception e)
                {
                    System.out.println(e.getMessage());
                }
    }

private void carga_datos_catalogo(int opcion, int opbuscamp,String busqueda,int almacen,String cantidad)
 {
       DecimalFormat miformat = new DecimalFormat("###,###,###,###.##");
       Object[] fnewRow = new Object[9];
       String texto="select * from x1distribucion_terminados_articulos_catalogo("+opcion+","+opbuscamp+",'"+busqueda+"') as (id character varying(16),idstatus smallint,statusdescribe text,describearticulo character varying(80),describcorta character varying(20),unsal character varying(3),unent character varying(3),facentruni numeric,uniempaque character varying(12),idtempo smallint,describetemp text,idfamilia character varying(5),familiadescribe character varying(40),controlalma character varying(20),stocminimo numeric,stocmaximo numeric,precio1 numeric,perecio2 numeric,precio3 numeric,precio4 numeric,precio5 numeric,ultimocosto numeric,costoprom numeric,pensurtir numeric,tiemposurtido smallint,acumprod numeric,acumimporte numeric,idtipoarticulo smallint,tipodescribe text,fechaprototipo date,fechaautoriza date,fechainiprod date,fechaultimaent date,usuario character varying(20),observacion character varying(255),idprovee character varying(12),nombrecreador character varying(80),valor_x character varying(20),valorx_st character varying(20),idpersonal character varying(16),nombrepersonal character varying(80),descripprovee character varying(60),existencia numeric)";

       System.out.println(texto);
       int encontrado=0;
       try
        {
           rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                    encontrado=1;
                    fnewRow[0]=rs.getString("id");
                    fnewRow[1]=rs.getString("describearticulo");
                    fnewRow[2]=rs.getString("unsal");
                    fnewRow[3]=cantidad;
                    fnewRow[4]=rs.getString("precio1");
                    fnewRow[5]=rs.getString("ultimocosto");
                    fnewRow[6]=this.jtf_partidaobser.getText().toString().toUpperCase()+".";
                    fnewRow[7]=rs.getString("valor_x");
                    fnewRow[8]=rs.getString("precio5");
                    jtable_modelo_doctomovidet.addRow(fnewRow);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
       if(encontrado==0)
                {
                    fnewRow[0]=busqueda;
                    fnewRow[1]="No existe";
                    fnewRow[2]=".";
                    fnewRow[3]=cantidad;
                    fnewRow[4]=".";
                    fnewRow[5]=".";
                    fnewRow[6]=this.jtf_partidaobser.getText().toString().toUpperCase()+".";
                    fnewRow[7]=busqueda;
                    fnewRow[8]=".";
                    jtable_modelo_doctomovidet.addRow(fnewRow);
                }
  }

void carga_datos_kardex(int opcion, String busqueda,String almacen)
 {
       DecimalFormat miformat = new DecimalFormat("###,###,###");
       DecimalFormat miformatd = new DecimalFormat("#########.##");
       while(jtable_modelo_kardex.getRowCount()>0)jtable_modelo_kardex.removeRow(0);
       float historial=0;
       Object[] fnewRow = new Object[15];
       String texto="select * from x1distribucion_terminados_articulos_kardex("+opcion+",'"+busqueda.toUpperCase().trim()+"',"+almacen+") as (folio integer,fechamov date,tipomovinve smallint,tipodescribe text,referenciainve character varying(16),fechareferencia date,clave_clie_prov character varying(12),idarticuloinve character varying(16),cantidadinve numeric,precioinve numeric,costoinve numeric,observainve character varying(80),descripcionarti character varying(80),unidadsal character varying(3),almacen smallint,describealmacen character varying(30),precio5 numeric,item character varying(20))",abrehtml="",cierrahtml="";
       
       System.out.println(texto);
       try
        {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                if(rs.getFloat("cantidadinve") > 0 )//significa que fue entrada
                    {
                        abrehtml="<html><b>";
                        cierrahtml="</b></html>";
                    }
                else
                    {
                        abrehtml="";
                        cierrahtml="";
                    }
                    historial+=rs.getFloat("cantidadinve");
                    fnewRow[0]=rs.getString ("almacen")+":"+rs.getString ("describealmacen");
                    fnewRow[1]=rs.getString ("folio");
                    fnewRow[2]=this.fechaeuropea(rs.getString("fechareferencia"));
                    fnewRow[3]=rs.getString ("tipomovinve")+":"+rs.getString("tipodescribe");
                    fnewRow[4]=rs.getString ("referenciainve");
                    fnewRow[5]=rs.getString ("clave_clie_prov");
                    fnewRow[6]=rs.getString ("idarticuloinve");
                    fnewRow[7]=rs.getString ("descripcionarti");
                    fnewRow[8]=rs.getString ("item");
                    fnewRow[9]=rs.getString ("unidadsal");
                    fnewRow[10]=miformat.format(rs.getFloat("costoinve"));
                    fnewRow[11]=miformat.format(rs.getFloat("precioinve"));
                    fnewRow[12]=abrehtml+rs.getString ("cantidadinve")+cierrahtml;
                    fnewRow[13]=abrehtml+miformat.format(historial)+cierrahtml;
                    fnewRow[14]=rs.getString ("observainve");
                    jtable_modelo_kardex.addRow(fnewRow);
                }

        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }

 }
private void carga_datos_movinventariodocto(int opbus,String tbusca)
{
       String fechacat = "",fechaorigen="",fechaentrega="";
       DecimalFormat miformat = new DecimalFormat("###,###,###,###");
       Object[] fnewRow = new Object[11];
       while(jtable_modelo_doctomovinve.getRowCount()>0)jtable_modelo_doctomovinve.removeRow(0);
       String cadenasql="select * from x1distribucion_terminados_artic_mov_catalogodocto("+opbus+",'"+tbusca+"') as (iddocto integer,fecha date,doctoref character varying(12),idmovimiento smallint,idstatus smallint,idaplico integer,observacion text,describetipomov text,nombre character varying(50),nombreapaterno character varying(50),totalpiezas numeric,totalcosto numeric,totalprecio numeric,diastras integer,idalma smallint,hora time);";
       //invoco al metodo que trae el recordset de datos
       System.out.println(cadenasql);

        try
         {
         rs = x.sieuno_executediversosv2(cadenasql,variables_global.getconexiongral());
            while (rs.next())
                {
                    fechaentrega="";
                    fnewRow[0]=rs.getString("idmovimiento")+":"+rs.getString("describetipomov");
                    fnewRow[1]=rs.getString("idalma");
                    fnewRow[2]=rs.getString("idstatus")+":ORIGINAL";
                    fnewRow[3]=rs.getString("iddocto")+":"+rs.getString("doctoref");
                    fnewRow[4]=rs.getString("idaplico")+":"+rs.getString("nombre")+" "+rs.getString("nombreapaterno");
                    fechaorigen="<html>"+this.fechaeuropea(rs.getString("fecha"))+":<br>"+DiaSemana(this.fechaeuropea(rs.getString ("fecha")))+"</html>";
                    fnewRow[5]=fechaorigen;
                    fnewRow[6]=rs.getString("diastras");
                    fnewRow[7]=miformat.format(rs.getFloat("totalpiezas"));
                    fnewRow[8]=miformat.format(rs.getFloat("totalcosto"));
                    fnewRow[9]=miformat.format(rs.getFloat("totalprecio"));
                    fnewRow[10]=rs.getString("observacion");
                   jtable_modelo_doctomovinve.addRow(fnewRow);
                }
        }
        catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
        int numerofilas=this.jtable_modelo_doctomovinve.getRowCount();
           for(int i = 0 ;i < numerofilas; i++)
                {
                   jt_almamoviextras.setRowHeight(i, 30);
                }
}

private void carga_datos_detalle_movinve(int opbus,String folio)
{

       DecimalFormat miformat = new DecimalFormat("###,###,###,###");
       DecimalFormat miformatde = new DecimalFormat("###,###,###,###.##");
       Object[] fnewRow = new Object[9];
       String texto="select * from x1distribucion_terminados_artic_mov_catalogodetalle("+opbus+",'"+folio+"') as (idreg integer,iddocto integer,idarti character varying(16),cantidad numeric,costo numeric,precio numeric,obserpartida text,descripcion character varying(80),unidadsal character varying(3),describetipo character varying(40),precio5 numeric,item character varying(20),item2 character varying(80));";
       //invoco al metodo que trae el recordset de datos
       System.out.println(texto);
       while(jtable_modelo_doctodetimprimir.getRowCount()>0)jtable_modelo_doctodetimprimir.removeRow(0);
        try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                    fnewRow[0]=rs.getString("iddocto");
                    fnewRow[1]=rs.getString("idarti");
                    fnewRow[2]=rs.getString("descripcion");
                    fnewRow[3]=rs.getString("item");
                    fnewRow[4]=rs.getString("unidadsal");
                    fnewRow[5]=miformat.format(rs.getFloat("cantidad"));
                    fnewRow[6]=miformatde.format(rs.getFloat("costo"));
                    fnewRow[7]=miformat.format(rs.getFloat("precio5"));
                    fnewRow[8]=rs.getString("obserpartida");
                    jtable_modelo_doctodetimprimir.addRow(fnewRow);
                }
        }
        catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
}

private String  fechaeuropea(String fecha) {
         //resibe cadena de fecha en formato americano yyyy-MM-dd
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;

    }

private String fechaamericana(Date fe) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fe);
       return cadenafecha;
    }
private String DiaSemana(String fe) {
       String dia = "";
       java.util.Date fecha=null;
         try
           {
             fecha = formateador.parse(fe);
           }
        catch (ParseException e)
            {
            //Error, la cadena de texto no se puede convertir en fecha.
            }
        Calendar cal= Calendar.getInstance();
        cal.setTime(fecha);
        //ojo para establecer o recetear cada parte de la fecha por separado
        //cal.set(Calendar.YEAR, fecha.getYear());
        //cal.set(Calendar.MONTH, fecha.getMonth());
        //cal.set(Calendar.DAY_OF_MONTH, fecha.getDay());
        int diaInt = cal.get(Calendar.DAY_OF_WEEK);
        switch (diaInt) {
            case 1:
                dia = "Domingo";
                break;
            case 2:
                dia = "Lunes";
                break;
            case 3:
                dia = "Martes";
                break;
            case 4:
                dia = "Miercoles";
                break;
            case 5:
                dia = "Jueves";
                break;
            case 6:
                dia = "Viernes";
                break;
            case 7:
                dia = "Sabado";
                break;

        }
        return dia;
    }
private void dioclickdm(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        System.out.println("dio doble  click");
        int fila = jt_almamoviextras.getSelectedRow();
        String idcadena[]=this.jtable_modelo_doctomovinve.getValueAt(fila, 3).toString().split(":");
        this.carga_datos_detalle_movinve(0, idcadena[0]);
        this.jtf_movidfolio.setText(this.jtable_modelo_doctomovinve.getValueAt(fila, 3).toString());
        this.jtf_movfecha.setText(this.jtable_modelo_doctomovinve.getValueAt(fila, 5).toString().replace("<html>", "").replace("</html>", "").replace("<br>", ""));
        this.jtf_movdescribe.setText(this.jtable_modelo_doctomovinve.getValueAt(fila, 0).toString());
        this.jtf_movalmacen.setText(this.jtable_modelo_doctomovinve.getValueAt(fila, 1).toString());
        this.jtf_piezasmov.setText(this.jtable_modelo_doctomovinve.getValueAt(fila, 7).toString());
        
        //setVisible(false);
    }

private void imprimir(int pag,float ptotal)
    {
     this.objimpresora=new com_distri_folios_imprimir();

     this.objimpresora.setOneItem_cadenas_a_imprimir("Moviemientos al Inventario");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Folio:"+this.jtf_movidfolio.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Fecha:"+this.jtf_movfecha.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Movimiento:"+this.jtf_movdescribe.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Almacen:"+this.jtf_movalmacen.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Total Piezas:"+this.jtf_piezasmov.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("pagina:"+ pag + " de "+ptotal+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Responsable Almacen: ______________");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Empaco: ______________");
     this.objimpresora.setOneItem_cadenas_a_imprimir("Recibio: ______________");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..");
     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     this.objimpresora.setObjeto_tabla(jtb_detallemovinve);
     this.objimpresora.imprimir_all(5,pag);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jtbl_kardex = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }}
            ;
            jLabel1 = new javax.swing.JLabel();
            jtf_busqueda = new javax.swing.JTextField();
            jbtn_buscar = new javax.swing.JButton();
            jrb_bclave = new javax.swing.JRadioButton();
            jrb_bdescrip = new javax.swing.JRadioButton();
            jrb_bitem = new javax.swing.JRadioButton();
            jrb_bitem1 = new javax.swing.JRadioButton();
            jrb_fechamov = new javax.swing.JRadioButton();
            jrb_fechamov1 = new javax.swing.JRadioButton();
            jPanel1 = new javax.swing.JPanel();
            jPanel7 = new javax.swing.JPanel();
            jScrollPane2 = new javax.swing.JScrollPane();
            jt_almamoviextras = new javax.swing.JTable()
            {
                public boolean isCellEditable(int rowIndex, int mColIndex) {
                    return false;
                }
            }
            ;
            jlbl_textobuscado = new javax.swing.JLabel();
            jScrollPane5 = new javax.swing.JScrollPane();
            jtb_detallemovinve = new javax.swing.JTable(){
                public boolean isCellEditable(int rowIndex, int mColIndex) {
                    return false;
                }}
                ;
                jLabel8 = new javax.swing.JLabel();
                jtf_movidfolio = new javax.swing.JTextField();
                jLabel9 = new javax.swing.JLabel();
                jtf_movdescribe = new javax.swing.JTextField();
                jLabel11 = new javax.swing.JLabel();
                jtf_movalmacen = new javax.swing.JTextField();
                jbtn_Imprimir = new javax.swing.JButton();
                jLabel12 = new javax.swing.JLabel();
                jtf_movfecha = new javax.swing.JTextField();
                jLabel13 = new javax.swing.JLabel();
                jtf_piezasmov = new javax.swing.JTextField();
                jPanel2 = new javax.swing.JPanel();
                jPanel3 = new javax.swing.JPanel();
                jdc_fechadocto = new com.toedter.calendar.JDateChooser();
                jLabel2 = new javax.swing.JLabel();
                jtf_observaciones = new javax.swing.JTextField();
                jLabel4 = new javax.swing.JLabel();
                jLabel6 = new javax.swing.JLabel();
                jcmbx_almacenes = new javax.swing.JComboBox();
                jLabel3 = new javax.swing.JLabel();
                jtf_doctoreferencia = new javax.swing.JTextField();
                jLabel7 = new javax.swing.JLabel();
                jcmbx_idmovimientoalma = new javax.swing.JComboBox();
                jpn_cuerpo = new javax.swing.JPanel();
                jScrollPane1 = new javax.swing.JScrollPane();
                jtb_insumos = new javax.swing.JTable()
                {
                    public boolean isCellEditable(int rowIndex, int mColIndex) {
                        if (mColIndex < 3)
                        return false;
                        else
                        return true;
                    }
                }
                ;
                jScrollPane3 = new javax.swing.JScrollPane();
                jta_archivo = new javax.swing.JTextArea();
                jLabel10 = new javax.swing.JLabel();
                jbtn_importar = new javax.swing.JButton();
                jLabel15 = new javax.swing.JLabel();
                jtf_movinvearticulos = new javax.swing.JTextField();
                jLabel16 = new javax.swing.JLabel();
                jtf_piezas = new javax.swing.JTextField();
                jPanel4 = new javax.swing.JPanel();
                jLabel5 = new javax.swing.JLabel();
                jtf_canpzaingresa = new javax.swing.JTextField();
                jLabel14 = new javax.swing.JLabel();
                jtf_idarticulo = new javax.swing.JTextField();
                jbtn_buscaridinsu = new javax.swing.JButton();
                jtf_partidaobser = new javax.swing.JTextField();
                jLabel17 = new javax.swing.JLabel();
                jbtn_codigo = new javax.swing.JRadioButton();
                jrbtn_item = new javax.swing.JRadioButton();
                jrbtn_controlalma = new javax.swing.JRadioButton();
                jPanel6 = new javax.swing.JPanel();
                jbtn_guardar = new javax.swing.JButton();
                jbtn_helpayudame = new javax.swing.JButton();
                jMenuBar1 = new javax.swing.JMenuBar();
                jMenu1 = new javax.swing.JMenu();
                jmni_salir = new javax.swing.JMenuItem();
                jMenu2 = new javax.swing.JMenu();
                jmni_escape = new javax.swing.JMenuItem();
                jmni_guardar = new javax.swing.JMenuItem();
                jMenu3 = new javax.swing.JMenu();

                setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
                org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(com_distri_articulos_movi_inve.class);
                setTitle(resourceMap.getString("Form.title")); // NOI18N
                setName("Form"); // NOI18N

                jTabbedPane1.setName("jTabbedPane1"); // NOI18N
                jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
                    public void stateChanged(javax.swing.event.ChangeEvent evt) {
                        jTabbedPane1StateChanged(evt);
                    }
                });

                jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel5.border.title"))); // NOI18N
                jPanel5.setName("jPanel5"); // NOI18N

                jScrollPane4.setName("jScrollPane4"); // NOI18N

                jtbl_kardex.setModel(this.jtable_modelo_kardex);
                jtbl_kardex.setName("jtbl_kardex"); // NOI18N
                jtbl_kardex.addMouseListener(new java.awt.event.MouseAdapter() {
                    public void mouseClicked(java.awt.event.MouseEvent evt) {
                        jtbl_kardexMouseClicked(evt);
                    }
                });
                jtbl_kardex.addKeyListener(new java.awt.event.KeyAdapter() {
                    public void keyPressed(java.awt.event.KeyEvent evt) {
                        jtbl_kardexKeyPressed(evt);
                    }
                });
                jScrollPane4.setViewportView(jtbl_kardex);

                jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
                jLabel1.setName("jLabel1"); // NOI18N

                jtf_busqueda.setToolTipText(resourceMap.getString("jtf_busqueda.toolTipText")); // NOI18N
                jtf_busqueda.setName("jtf_busqueda"); // NOI18N
                jtf_busqueda.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jtf_busquedaActionPerformed(evt);
                    }
                });

                jbtn_buscar.setText(resourceMap.getString("jbtn_buscar.text")); // NOI18N
                jbtn_buscar.setName("jbtn_buscar"); // NOI18N
                jbtn_buscar.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_buscarActionPerformed(evt);
                    }
                });

                buttonGroup1.add(jrb_bclave);
                jrb_bclave.setText(resourceMap.getString("jrb_bclave.text")); // NOI18N
                jrb_bclave.setToolTipText(resourceMap.getString("jrb_bclave.toolTipText")); // NOI18N
                jrb_bclave.setActionCommand(resourceMap.getString("jrb_bclave.actionCommand")); // NOI18N
                jrb_bclave.setName("jrb_bclave"); // NOI18N
                jrb_bclave.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bclaveActionPerformed(evt);
                    }
                });

                buttonGroup1.add(jrb_bdescrip);
                jrb_bdescrip.setText(resourceMap.getString("jrb_bdescrip.text")); // NOI18N
                jrb_bdescrip.setToolTipText(resourceMap.getString("jrb_bdescrip.toolTipText")); // NOI18N
                jrb_bdescrip.setActionCommand(resourceMap.getString("jrb_bdescrip.actionCommand")); // NOI18N
                jrb_bdescrip.setName("jrb_bdescrip"); // NOI18N
                jrb_bdescrip.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bdescripActionPerformed(evt);
                    }
                });

                buttonGroup1.add(jrb_bitem);
                jrb_bitem.setText(resourceMap.getString("jrb_bitem.text")); // NOI18N
                jrb_bitem.setToolTipText(resourceMap.getString("jrb_bitem.toolTipText")); // NOI18N
                jrb_bitem.setActionCommand(resourceMap.getString("jrb_bitem.actionCommand")); // NOI18N
                jrb_bitem.setName("jrb_bitem"); // NOI18N
                jrb_bitem.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bitemActionPerformed(evt);
                    }
                });

                buttonGroup1.add(jrb_bitem1);
                jrb_bitem1.setText(resourceMap.getString("jrb_bitem1.text")); // NOI18N
                jrb_bitem1.setToolTipText(resourceMap.getString("jrb_bitem1.toolTipText")); // NOI18N
                jrb_bitem1.setActionCommand(resourceMap.getString("jrb_bitem1.actionCommand")); // NOI18N
                jrb_bitem1.setName("jrb_bitem1"); // NOI18N
                jrb_bitem1.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bitem1ActionPerformed(evt);
                    }
                });

                buttonGroup1.add(jrb_fechamov);
                jrb_fechamov.setText(resourceMap.getString("jrb_fechamov.text")); // NOI18N
                jrb_fechamov.setToolTipText(resourceMap.getString("jrb_fechamov.toolTipText")); // NOI18N
                jrb_fechamov.setActionCommand(resourceMap.getString("jrb_fechamov.actionCommand")); // NOI18N
                jrb_fechamov.setName("jrb_fechamov"); // NOI18N
                jrb_fechamov.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_fechamovActionPerformed(evt);
                    }
                });

                buttonGroup1.add(jrb_fechamov1);
                jrb_fechamov1.setText(resourceMap.getString("jrb_fechamov1.text")); // NOI18N
                jrb_fechamov1.setToolTipText(resourceMap.getString("jrb_fechamov1.toolTipText")); // NOI18N
                jrb_fechamov1.setActionCommand(resourceMap.getString("jrb_fechamov1.actionCommand")); // NOI18N
                jrb_fechamov1.setName("jrb_fechamov1"); // NOI18N
                jrb_fechamov1.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_fechamov1ActionPerformed(evt);
                    }
                });

                javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
                jPanel5.setLayout(jPanel5Layout);
                jPanel5Layout.setHorizontalGroup(
                    jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(167, 167, 167)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(jrb_bclave)
                                .addGap(18, 18, 18)
                                .addComponent(jrb_bdescrip)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jrb_bitem)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_bitem1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jrb_fechamov)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_fechamov1))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jbtn_buscar)))
                        .addContainerGap(446, Short.MAX_VALUE))
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 1057, Short.MAX_VALUE)
                );
                jPanel5Layout.setVerticalGroup(
                    jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jbtn_buscar))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jrb_bitem)
                            .addComponent(jrb_bdescrip)
                            .addComponent(jrb_bclave)
                            .addComponent(jrb_bitem1)
                            .addComponent(jrb_fechamov)
                            .addComponent(jrb_fechamov1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 519, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(40, Short.MAX_VALUE))
                );

                jTabbedPane1.addTab(resourceMap.getString("jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N

                jPanel1.setName("jPanel1"); // NOI18N

                jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel7.border.title"))); // NOI18N
                jPanel7.setName("jPanel7"); // NOI18N

                jScrollPane2.setName("jScrollPane2"); // NOI18N

                jt_almamoviextras.setModel(this.jtable_modelo_doctomovinve);
                jt_almamoviextras.setName("jt_almamoviextras"); // NOI18N
                jt_almamoviextras.addMouseListener(new java.awt.event.MouseAdapter() {
                    public void mouseClicked(java.awt.event.MouseEvent evt) {
                        jt_almamoviextrasMouseClicked(evt);
                        if(evt.getClickCount() >= 2)
                        {
                            dioclickdm(evt);
                            //System.out.println(" double click" );
                        }
                    }
                });
                jScrollPane2.setViewportView(jt_almamoviextras);

                jlbl_textobuscado.setFont(resourceMap.getFont("jlbl_textobuscado.font")); // NOI18N
                jlbl_textobuscado.setName("jlbl_textobuscado"); // NOI18N

                jScrollPane5.setName("jScrollPane5"); // NOI18N

                jtb_detallemovinve.setModel(this.jtable_modelo_doctodetimprimir);
                jtb_detallemovinve.setName("jtb_detallemovinve"); // NOI18N
                jScrollPane5.setViewportView(jtb_detallemovinve);

                jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
                jLabel8.setName("jLabel8"); // NOI18N

                jtf_movidfolio.setEditable(false);
                jtf_movidfolio.setText(resourceMap.getString("jtf_movidfolio.text")); // NOI18N
                jtf_movidfolio.setName("jtf_movidfolio"); // NOI18N

                jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
                jLabel9.setName("jLabel9"); // NOI18N

                jtf_movdescribe.setEditable(false);
                jtf_movdescribe.setText(resourceMap.getString("jtf_movdescribe.text")); // NOI18N
                jtf_movdescribe.setName("jtf_movdescribe"); // NOI18N

                jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
                jLabel11.setName("jLabel11"); // NOI18N

                jtf_movalmacen.setEditable(false);
                jtf_movalmacen.setText(resourceMap.getString("jtf_movalmacen.text")); // NOI18N
                jtf_movalmacen.setName("jtf_movalmacen"); // NOI18N

                jbtn_Imprimir.setIcon(resourceMap.getIcon("jbtn_Imprimir.icon")); // NOI18N
                jbtn_Imprimir.setText(resourceMap.getString("jbtn_Imprimir.text")); // NOI18N
                jbtn_Imprimir.setName("jbtn_Imprimir"); // NOI18N
                jbtn_Imprimir.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_ImprimirActionPerformed(evt);
                    }
                });

                jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
                jLabel12.setName("jLabel12"); // NOI18N

                jtf_movfecha.setEditable(false);
                jtf_movfecha.setText(resourceMap.getString("jtf_movfecha.text")); // NOI18N
                jtf_movfecha.setName("jtf_movfecha"); // NOI18N

                jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
                jLabel13.setName("jLabel13"); // NOI18N

                jtf_piezasmov.setEditable(false);
                jtf_piezasmov.setText(resourceMap.getString("jtf_piezasmov.text")); // NOI18N
                jtf_piezasmov.setName("jtf_piezasmov"); // NOI18N

                javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
                jPanel7.setLayout(jPanel7Layout);
                jPanel7Layout.setHorizontalGroup(
                    jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(81, 81, 81)
                        .addComponent(jlbl_textobuscado, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(868, Short.MAX_VALUE))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1037, Short.MAX_VALUE)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 693, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addComponent(jLabel8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_movidfolio, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_movdescribe, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addComponent(jLabel11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_movalmacen, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_movfecha, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jbtn_Imprimir)
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_piezasmov, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(132, Short.MAX_VALUE))
                );
                jPanel7Layout.setVerticalGroup(
                    jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jlbl_textobuscado)
                        .addGap(49, 49, 49)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 294, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel8)
                                    .addComponent(jtf_movidfolio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel12)
                                    .addComponent(jtf_movfecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(19, 19, 19)
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel9)
                                    .addComponent(jtf_movdescribe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel11)
                                    .addComponent(jtf_movalmacen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel13)
                                    .addComponent(jtf_piezasmov, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jbtn_Imprimir)
                                .addGap(25, 25, 25))))
                );

                javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
                jPanel1.setLayout(jPanel1Layout);
                jPanel1Layout.setHorizontalGroup(
                    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                );
                jPanel1Layout.setVerticalGroup(
                    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                );

                jTabbedPane1.addTab(resourceMap.getString("jPanel1.TabConstraints.tabTitle"), jPanel1); // NOI18N

                jPanel2.setName("jPanel2"); // NOI18N

                jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
                jPanel3.setName("jPanel3"); // NOI18N

                jdc_fechadocto.setDateFormatString(resourceMap.getString("jdc_fechadocto.dateFormatString")); // NOI18N
                jdc_fechadocto.setName("jdc_fechadocto"); // NOI18N
                jdc_fechadocto.setNextFocusableComponent(jcmbx_almacenes);

                jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
                jLabel2.setName("jLabel2"); // NOI18N

                jtf_observaciones.setName("jtf_observaciones"); // NOI18N
                jtf_observaciones.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jtf_observacionesActionPerformed(evt);
                    }
                });

                jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
                jLabel4.setName("jLabel4"); // NOI18N

                jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
                jLabel6.setName("jLabel6"); // NOI18N

                jcmbx_almacenes.setName("jcmbx_almacenes"); // NOI18N
                jcmbx_almacenes.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jcmbx_almacenesActionPerformed(evt);
                    }
                });

                jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
                jLabel3.setName("jLabel3"); // NOI18N

                jtf_doctoreferencia.setName("jtf_doctoreferencia"); // NOI18N
                jtf_doctoreferencia.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jtf_doctoreferenciaActionPerformed(evt);
                    }
                });

                jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
                jLabel7.setName("jLabel7"); // NOI18N

                jcmbx_idmovimientoalma.setName("jcmbx_idmovimientoalma"); // NOI18N
                jcmbx_idmovimientoalma.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jcmbx_idmovimientoalmaActionPerformed(evt);
                    }
                });

                javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
                jPanel3.setLayout(jPanel3Layout);
                jPanel3Layout.setHorizontalGroup(
                    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jdc_fechadocto, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jcmbx_almacenes, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_doctoreferencia, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jcmbx_idmovimientoalma, 0, 401, Short.MAX_VALUE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel4)
                                .addGap(18, 18, 18)
                                .addComponent(jtf_observaciones, javax.swing.GroupLayout.PREFERRED_SIZE, 722, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())
                );
                jPanel3Layout.setVerticalGroup(
                    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jdc_fechadocto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jcmbx_almacenes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel3)
                                .addComponent(jtf_doctoreferencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel7)
                                .addComponent(jcmbx_idmovimientoalma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel6)))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jtf_observaciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                );

                jpn_cuerpo.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jpn_cuerpo.border.title"))); // NOI18N
                jpn_cuerpo.setName("jpn_cuerpo"); // NOI18N

                jScrollPane1.setName("jScrollPane1"); // NOI18N

                jtb_insumos.setModel(this.jtable_modelo_doctomovidet);
                jtb_insumos.setName("jtb_insumos"); // NOI18N
                jScrollPane1.setViewportView(jtb_insumos);

                jScrollPane3.setName("jScrollPane3"); // NOI18N

                jta_archivo.setColumns(20);
                jta_archivo.setRows(5);
                jta_archivo.setName("jta_archivo"); // NOI18N
                jScrollPane3.setViewportView(jta_archivo);

                jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
                jLabel10.setName("jLabel10"); // NOI18N

                jbtn_importar.setIcon(resourceMap.getIcon("jbtn_importar.icon")); // NOI18N
                jbtn_importar.setText(resourceMap.getString("jbtn_importar.text")); // NOI18N
                jbtn_importar.setName("jbtn_importar"); // NOI18N
                jbtn_importar.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_importarActionPerformed(evt);
                    }
                });

                jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
                jLabel15.setName("jLabel15"); // NOI18N

                jtf_movinvearticulos.setEditable(false);
                jtf_movinvearticulos.setText(resourceMap.getString("jtf_movinvearticulos.text")); // NOI18N
                jtf_movinvearticulos.setName("jtf_movinvearticulos"); // NOI18N

                jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
                jLabel16.setName("jLabel16"); // NOI18N

                jtf_piezas.setEditable(false);
                jtf_piezas.setText(resourceMap.getString("jtf_piezas.text")); // NOI18N
                jtf_piezas.setName("jtf_piezas"); // NOI18N

                javax.swing.GroupLayout jpn_cuerpoLayout = new javax.swing.GroupLayout(jpn_cuerpo);
                jpn_cuerpo.setLayout(jpn_cuerpoLayout);
                jpn_cuerpoLayout.setHorizontalGroup(
                    jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtn_importar)
                        .addGap(387, 387, 387))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1047, Short.MAX_VALUE)
                    .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                        .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(176, 176, 176)
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_movinvearticulos, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel16)
                        .addGap(4, 4, 4)
                        .addComponent(jtf_piezas, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                );
                jpn_cuerpoLayout.setVerticalGroup(
                    jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpn_cuerpoLayout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10)
                            .addComponent(jLabel15)
                            .addComponent(jtf_movinvearticulos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel16)
                            .addComponent(jtf_piezas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                                .addComponent(jbtn_importar)
                                .addGap(27, 27, 27))
                            .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap())))
                );

                jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel4.border.title"))); // NOI18N
                jPanel4.setName("jPanel4"); // NOI18N

                jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
                jLabel5.setName("jLabel5"); // NOI18N

                jtf_canpzaingresa.setText(resourceMap.getString("jtf_canpzaingresa.text")); // NOI18N
                jtf_canpzaingresa.setToolTipText(resourceMap.getString("jtf_canpzaingresa.toolTipText")); // NOI18N
                jtf_canpzaingresa.setName("jtf_canpzaingresa"); // NOI18N
                jtf_canpzaingresa.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jtf_canpzaingresaActionPerformed(evt);
                    }
                });

                jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
                jLabel14.setName("jLabel14"); // NOI18N

                jtf_idarticulo.setToolTipText(resourceMap.getString("jtf_idarticulo.toolTipText")); // NOI18N
                jtf_idarticulo.setName("jtf_idarticulo"); // NOI18N
                jtf_idarticulo.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jtf_idarticuloActionPerformed(evt);
                    }
                });

                jbtn_buscaridinsu.setIcon(resourceMap.getIcon("jbtn_buscaridinsu.icon")); // NOI18N
                jbtn_buscaridinsu.setText(resourceMap.getString("jbtn_buscaridinsu.text")); // NOI18N
                jbtn_buscaridinsu.setName("jbtn_buscaridinsu"); // NOI18N
                jbtn_buscaridinsu.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_buscaridinsuActionPerformed(evt);
                    }
                });

                jtf_partidaobser.setText(resourceMap.getString("jtf_partidaobser.text")); // NOI18N
                jtf_partidaobser.setName("jtf_partidaobser"); // NOI18N

                jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
                jLabel17.setName("jLabel17"); // NOI18N

                buttonGroup2.add(jbtn_codigo);
                jbtn_codigo.setText(resourceMap.getString("jbtn_codigo.text")); // NOI18N
                jbtn_codigo.setActionCommand(resourceMap.getString("jbtn_codigo.actionCommand")); // NOI18N
                jbtn_codigo.setName("jbtn_codigo"); // NOI18N
                jbtn_codigo.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_codigoActionPerformed(evt);
                    }
                });

                buttonGroup2.add(jrbtn_item);
                jrbtn_item.setText(resourceMap.getString("jrbtn_item.text")); // NOI18N
                jrbtn_item.setActionCommand(resourceMap.getString("jrbtn_item.actionCommand")); // NOI18N
                jrbtn_item.setName("jrbtn_item"); // NOI18N
                jrbtn_item.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrbtn_itemActionPerformed(evt);
                    }
                });

                buttonGroup2.add(jrbtn_controlalma);
                jrbtn_controlalma.setText(resourceMap.getString("jrbtn_controlalma.text")); // NOI18N
                jrbtn_controlalma.setActionCommand(resourceMap.getString("jrbtn_controlalma.actionCommand")); // NOI18N
                jrbtn_controlalma.setName("jrbtn_controlalma"); // NOI18N
                jrbtn_controlalma.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrbtn_controlalmaActionPerformed(evt);
                    }
                });

                javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
                jPanel4.setLayout(jPanel4Layout);
                jPanel4Layout.setHorizontalGroup(
                    jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_canpzaingresa, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_idarticulo, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jbtn_buscaridinsu, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel17)
                                .addGap(29, 29, 29)
                                .addComponent(jtf_partidaobser, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jbtn_codigo)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jrbtn_item)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrbtn_controlalma)))
                        .addContainerGap(341, Short.MAX_VALUE))
                );
                jPanel4Layout.setVerticalGroup(
                    jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jtf_idarticulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_canpzaingresa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14)
                            .addComponent(jbtn_buscaridinsu)
                            .addComponent(jLabel5)
                            .addComponent(jtf_partidaobser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel17))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jbtn_codigo)
                            .addComponent(jrbtn_item)
                            .addComponent(jrbtn_controlalma)))
                );

                jPanel6.setBorder(javax.swing.BorderFactory.createEtchedBorder());
                jPanel6.setName("jPanel6"); // NOI18N

                jbtn_guardar.setIcon(resourceMap.getIcon("jbtn_guardar.icon")); // NOI18N
                jbtn_guardar.setText(resourceMap.getString("jbtn_guardar.text")); // NOI18N
                jbtn_guardar.setName("jbtn_guardar"); // NOI18N
                jbtn_guardar.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_guardarActionPerformed(evt);
                    }
                });

                jbtn_helpayudame.setText(resourceMap.getString("jbtn_helpayudame.text")); // NOI18N
                jbtn_helpayudame.setName("jbtn_helpayudame"); // NOI18N
                jbtn_helpayudame.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_helpayudameActionPerformed(evt);
                    }
                });

                javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
                jPanel6.setLayout(jPanel6Layout);
                jPanel6Layout.setHorizontalGroup(
                    jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addContainerGap(852, Short.MAX_VALUE)
                        .addComponent(jbtn_helpayudame, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(127, 127, 127))
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel6Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jbtn_guardar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(929, Short.MAX_VALUE)))
                );
                jPanel6Layout.setVerticalGroup(
                    jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jbtn_helpayudame)
                        .addContainerGap(16, Short.MAX_VALUE))
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel6Layout.createSequentialGroup()
                            .addGap(2, 2, 2)
                            .addComponent(jbtn_guardar)
                            .addContainerGap(12, Short.MAX_VALUE)))
                );

                javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
                jPanel2.setLayout(jPanel2Layout);
                jPanel2Layout.setHorizontalGroup(
                    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jpn_cuerpo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addContainerGap())
                );
                jPanel2Layout.setVerticalGroup(
                    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jpn_cuerpo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(12, 12, 12))
                );

                jTabbedPane1.addTab(resourceMap.getString("jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N

                jMenuBar1.setName("jMenuBar1"); // NOI18N

                jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
                jMenu1.setName("jMenu1"); // NOI18N

                jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
                jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
                jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
                jmni_salir.setName("jmni_salir"); // NOI18N
                jmni_salir.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jmni_salirActionPerformed(evt);
                    }
                });
                jMenu1.add(jmni_salir);

                jMenuBar1.add(jMenu1);

                jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
                jMenu2.setName("jMenu2"); // NOI18N

                jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
                jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
                jmni_escape.setName("jmni_escape"); // NOI18N
                jmni_escape.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jmni_escapeActionPerformed(evt);
                    }
                });
                jMenu2.add(jmni_escape);

                jmni_guardar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F7, 0));
                jmni_guardar.setText(resourceMap.getString("jmni_guardar.text")); // NOI18N
                jmni_guardar.setName("jmni_guardar"); // NOI18N
                jmni_guardar.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jmni_guardarActionPerformed(evt);
                    }
                });
                jMenu2.add(jmni_guardar);

                jMenuBar1.add(jMenu2);

                jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N
                jMenu3.setName("jMenu3"); // NOI18N
                jMenuBar1.add(jMenu3);

                setJMenuBar(jMenuBar1);

                javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
                getContentPane().setLayout(layout);
                layout.setHorizontalGroup(
                    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1078, Short.MAX_VALUE)
                );
                layout.setVerticalGroup(
                    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jTabbedPane1))
                );

                pack();
            }// </editor-fold>//GEN-END:initComponents

    private void jtbl_kardexMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtbl_kardexMouseClicked
        // TODO add your handling code here:
}//GEN-LAST:event_jtbl_kardexMouseClicked

    private void jtbl_kardexKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtbl_kardexKeyPressed
        // TODO add your handling code here:
}//GEN-LAST:event_jtbl_kardexKeyPressed

    private void jtf_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_busquedaActionPerformed
        // TODO add your handling code here:
        this.jbtn_buscarActionPerformed(evt);
}//GEN-LAST:event_jtf_busquedaActionPerformed

    private void jbtn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarActionPerformed
        // TODO add your handling code here:
        // this.jtf_busqueda.getText();
        if(JOptionPane.showConfirmDialog(null, "Estan Correctos sus Datos?")==0) {
            this.carga_datos_kardex(buscamp, this.jtf_busqueda.getText().toUpperCase().trim(), "0");
        } else {
            this.jtf_busqueda.requestFocus();
        }
}//GEN-LAST:event_jbtn_buscarActionPerformed

    private void jrb_bclaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bclaveActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bclaveActionPerformed

    private void jrb_bdescripActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bdescripActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bdescripActionPerformed

    private void jrb_bitemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bitemActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bitemActionPerformed

    private void jrb_bitem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bitem1ActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bitem1ActionPerformed

    private void jrb_fechamovActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_fechamovActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_fechamovActionPerformed

    private void jrb_fechamov1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_fechamov1ActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_fechamov1ActionPerformed

    private void jbtn_importarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_importarActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Importar Estos Articulos?")==0) {
            String arreglo_importa[]=this.jta_archivo.getText().split("\n");
            String arreglo_codigo[]=null;
            int piezasimpo=0;
            System.out.println("Estos tiene archivo:"+arreglo_importa.length);
            for (int i=0;i<arreglo_importa.length;i++) {
                arreglo_codigo=arreglo_importa[i].split("\t");
                this.jtf_idarticulo.setText(arreglo_codigo[0]);
                this.jtf_canpzaingresa.setText(arreglo_codigo[1]);
                piezasimpo+=Integer.valueOf(arreglo_codigo[1]);
                if(arreglo_codigo.length>2)
                    {
                        this.jtf_partidaobser.setText(arreglo_codigo[2]);
                    }
                this.jbtn_buscaridinsuActionPerformed(evt);
            }
            this.jtf_canpzaingresa.setText("0");
            this.jtf_idarticulo.setText("");
            this.jtf_idarticulo.requestFocus();
            int farti=this.jtable_modelo_doctomovidet.getRowCount();
            this.jtf_movinvearticulos.setText(String.valueOf(farti));
            this.jtf_piezas.setText(String.valueOf(piezasimpo));
            this.jta_archivo.setText("");
            
        }
}//GEN-LAST:event_jbtn_importarActionPerformed

    private void jtf_canpzaingresaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_canpzaingresaActionPerformed
        // TODO add your handling code here:
        this.jtf_idarticulo.requestFocus();
}//GEN-LAST:event_jtf_canpzaingresaActionPerformed

    private void jtf_idarticuloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_idarticuloActionPerformed
        // TODO add your handling code here:

        this.jbtn_buscaridinsuActionPerformed(evt);
}//GEN-LAST:event_jtf_idarticuloActionPerformed

    private void jbtn_buscaridinsuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscaridinsuActionPerformed
        // TODO add your handling code here:
        if(this.jtf_idarticulo.getText().length()>0) {
            this.carga_datos_catalogo(opbuscamp, 1, this.jtf_idarticulo.getText().trim().toUpperCase(), 0,this.jtf_canpzaingresa.getText().trim());
        }
}//GEN-LAST:event_jbtn_buscaridinsuActionPerformed

    private void jbtn_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_guardarActionPerformed
        // TODO add your handling code here:
        String cadenafilas="",punto="";
        float cantidad=0,totalpiezas=0;
        int nobjetotabla=this.jtable_modelo_doctomovidet.getRowCount();
        int fi=0,controlfolio=0,error=0;
        for(fi=0;fi<nobjetotabla;fi++) {
            try{
                cantidad = Float.valueOf(this.jtable_modelo_doctomovidet.getValueAt(fi, 3).toString()).floatValue();
                totalpiezas+=cantidad;
            }catch (NumberFormatException nfe) {
                cantidad=0;
                error=1;
            }
            // System.out.println("cachar error"+cadenafilas);
            if (cantidad > 0) {
                cadenafilas+=""+this.jtable_modelo_doctomovidet.getValueAt(fi, 3).toString()+":"+this.jtable_modelo_doctomovidet.getValueAt(fi, 0).toString()+":"+this.jtable_modelo_doctomovidet.getValueAt(fi, 4)+""+"\n";
            }
        }//fin del for
        if ( (totalpiezas > 0) && (error==0) ) {
            if(JOptionPane.showConfirmDialog(null, "Documento sera Guardado. Estan correcto sus Datos?")==0) {
                for(int i = 0 ;i < nobjetotabla; i++) {
                    punto=jtable_modelo_doctomovidet.getValueAt(i, 6).toString().replace(".", "")+".";
                    jtable_modelo_doctomovidet.setValueAt(punto, i,6);
                }
                String arreglo_alma[]=this.jcmbx_almacenes.getSelectedItem().toString().split(":");
                String arreglo_tipomov[]=this.jcmbx_idmovimientoalma.getSelectedItem().toString().split(":");
                java.util.Vector arreglodearticulos=this.jtable_modelo_doctomovidet.getDataVector();
                String articulos_papostgresql=arreglodearticulos.toString();
                articulos_papostgresql=articulos_papostgresql.replace('[','{');
                articulos_papostgresql=articulos_papostgresql.replace(']','}');
                articulos_papostgresql=articulos_papostgresql.replace("null",".");
                String texto="select * from x1distribucion_terminados_artic_mov_inve(1,'"+this.fechaamericana(this.jdc_fechadocto.getDate())+"','"+this.jtf_doctoreferencia.getText().trim().toUpperCase()+"','"+arreglo_alma[0]+"','"+arreglo_tipomov[0]+"','1','"+variables_global.getId_empleado()+"','"+this.jtf_observaciones.getText().trim().toUpperCase().replace(",", "")+"','"+articulos_papostgresql+"')";
                System.out.println(texto);
                try {
                    rs=x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                    while (rs.next()) {
                        controlfolio=rs.getInt(1);
                        if (rs.getInt(1) > 0) {
                            JOptionPane.showMessageDialog(null,"Requisicion Correcta, Gracias", "Sistema Integral(Requisicion Insumos) : Confirmacion",1);
                        } else {
                            JOptionPane.showMessageDialog(null," Error Verifique sus Cantidades", "Sistema Integral(requisicion Insumos) : Error",1);
                        }
                    }
                } catch(Exception e) {
                    System.out.println(e.getMessage());
                    JOptionPane.showMessageDialog(null," Recepcion Incorrecta ", "Sistema Integral(Requisicion Insumos) : Error",1);
                }
            }//fin del if qu confirmo guardar diferencia
        } else {
            JOptionPane.showMessageDialog(null,"por Favor Verifique que Las Cantidades Sean Numericas");
        }


    }//GEN-LAST:event_jbtn_guardarActionPerformed

    private void jbtn_helpayudameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_helpayudameActionPerformed
        // TODO add your handling code here:
        // this.ayuda();
}//GEN-LAST:event_jbtn_helpayudameActionPerformed

    private void jTabbedPane1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane1StateChanged
        // TODO add your handling code here:
        indexactual=this.jTabbedPane1.getSelectedIndex();
        if((indexactual==1)&&(yacarguecatdocto==0)) {
            yacarguecatdocto=1;
            this.carga_datos_movinventariodocto(0,"");
        }
         if(indexactual==1)
            {
                this.jdc_fechadocto.requestFocus();
             }
}//GEN-LAST:event_jTabbedPane1StateChanged

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0) {
            this.dispose();
        }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jcmbx_almacenesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbx_almacenesActionPerformed
        // TODO add your handling code here:
        this.jtf_doctoreferencia.requestFocus();
    }//GEN-LAST:event_jcmbx_almacenesActionPerformed

    private void jtf_doctoreferenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_doctoreferenciaActionPerformed
        // TODO add your handling code here:
        this.jcmbx_idmovimientoalma.requestFocus();
    }//GEN-LAST:event_jtf_doctoreferenciaActionPerformed

    private void jcmbx_idmovimientoalmaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbx_idmovimientoalmaActionPerformed
        // TODO add your handling code here:
        this.jtf_observaciones.requestFocus();
    }//GEN-LAST:event_jcmbx_idmovimientoalmaActionPerformed

    private void jtf_observacionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_observacionesActionPerformed
        // TODO add your handling code here:
        this.jtf_canpzaingresa.requestFocus();
    }//GEN-LAST:event_jtf_observacionesActionPerformed

    private void jmni_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_guardarActionPerformed
        // TODO add your handling code here:
        this.jbtn_guardarActionPerformed(evt);
    }//GEN-LAST:event_jmni_guardarActionPerformed

    private void jbtn_ImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_ImprimirActionPerformed
        // TODO add your handling code here:
         float filas = this.jtable_modelo_doctodetimprimir.getRowCount() ;
        float paginas = filas /50;
        int ni=0;
        for(ni=0;ni<paginas;ni++)
             {
                 this.imprimir(ni,paginas);
             }
        //this.imprimir(1, 1);
    }//GEN-LAST:event_jbtn_ImprimirActionPerformed

    private void jbtn_codigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_codigoActionPerformed
        // TODO add your handling code here:
        opbuscamp=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jbtn_codigoActionPerformed

    private void jrbtn_itemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_itemActionPerformed
        // TODO add your handling code here:
         opbuscamp=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrbtn_itemActionPerformed

    private void jrbtn_controlalmaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_controlalmaActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jrbtn_controlalmaActionPerformed
    private void jt_almamoviextrasMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new com_distri_articulos_movi_inve().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jbtn_Imprimir;
    private javax.swing.JButton jbtn_buscar;
    private javax.swing.JButton jbtn_buscaridinsu;
    private javax.swing.JRadioButton jbtn_codigo;
    private javax.swing.JButton jbtn_guardar;
    private javax.swing.JButton jbtn_helpayudame;
    private javax.swing.JButton jbtn_importar;
    private javax.swing.JComboBox jcmbx_almacenes;
    private javax.swing.JComboBox jcmbx_idmovimientoalma;
    private com.toedter.calendar.JDateChooser jdc_fechadocto;
    private javax.swing.JLabel jlbl_textobuscado;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_guardar;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JPanel jpn_cuerpo;
    private javax.swing.JRadioButton jrb_bclave;
    private javax.swing.JRadioButton jrb_bdescrip;
    private javax.swing.JRadioButton jrb_bitem;
    private javax.swing.JRadioButton jrb_bitem1;
    private javax.swing.JRadioButton jrb_fechamov;
    private javax.swing.JRadioButton jrb_fechamov1;
    private javax.swing.JRadioButton jrbtn_controlalma;
    private javax.swing.JRadioButton jrbtn_item;
    private javax.swing.JTable jt_almamoviextras;
    private javax.swing.JTextArea jta_archivo;
    private javax.swing.JTable jtb_detallemovinve;
    private javax.swing.JTable jtb_insumos;
    private javax.swing.JTable jtbl_kardex;
    private javax.swing.JTextField jtf_busqueda;
    private javax.swing.JTextField jtf_canpzaingresa;
    private javax.swing.JTextField jtf_doctoreferencia;
    private javax.swing.JTextField jtf_idarticulo;
    private javax.swing.JTextField jtf_movalmacen;
    private javax.swing.JTextField jtf_movdescribe;
    private javax.swing.JTextField jtf_movfecha;
    private javax.swing.JTextField jtf_movidfolio;
    private javax.swing.JTextField jtf_movinvearticulos;
    private javax.swing.JTextField jtf_observaciones;
    private javax.swing.JTextField jtf_partidaobser;
    private javax.swing.JTextField jtf_piezas;
    private javax.swing.JTextField jtf_piezasmov;
    // End of variables declaration//GEN-END:variables
 private com_distri_folios_imprimir objimpresora;
}
